package com.tz.entity.dto;

import javax.validation.constraints.*;

/**
 * Created by yejf on 2017/1/17.
 * DTO, Data Transfer Object, 不是必须的
 */
public class UserDto {

    @NotNull
    @Size(min = 6, max = 12, message = "{user.name.invalid}")
    private String name;

    @NotNull
    @Size(min = 6, max = 12, message = "{user.password.invalid}")
    private String password;

    @Min(value = 18, message = "{user.age.invalid}")
    @Max(value = 80, message = "{user.age.invalid}")
    private int age;

    @Pattern(regexp = "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Za-z]{2,4}", message = "邮箱格式不正确!")
    private String email;

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public UserDto() {
        System.out.println("--- 创建了UserDto 对象....");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
